www.beck-ipc.com

@CHIP-RTOS C Library - TCP/IP API


Dev_Get_Buffer

Get a buffer for storing incoming data from the system's TCP/IP memory block.

int Dev_Get_Buffer( DevUserBufferHandle BufHandlePtr,
                    char far * far * buffer,
                    unsigned int length);

Parameters

BufHandlePtr

Output Parameter:   Pointer to location where this function will on success set a handle to the allocated buffer.   This handle is used internally by the @Chip-RTOS TCP/IP stack to manage the subsequent release of this allocated buffer.  This buffer release occurs automatically without further assistance from your application program.   (This value is for internal use only.)

buffer

Output Parameter:   Holds on success the pointer to the beginning of the allocated buffer.

length

Number of bytes buffer required

Return Value

0: success , *buffer points to the beginning of the allocated buffer
-1: Allocation failed, *buffer is a null pointer.

Comments

This API is intended for use exclusively from inside TCP/IP device driver receiver callback functions.   The BufHandlePtr passed to this API must be that received from the system in your receiver callback.   The TCP/IP stack obtains this handle in this manner.

Go here for example usage.

See Also

RTOS API

This library function invokes a RTOS software interrupt. Refer to this RTOS API function's documentation for more details.

On SC1x3/SC2x (RTOS version >=1.13, CLIB version >=2.10) there's also a version of this function which uses dynamic linking instead of a software interrupt, which reduces the function's overhead and thus speeds up your application. This function's name is Dev_Get_Buffer_Dyn. You should however not use this function directly. Instead you should add the define TCPIP_DYN_LINK_DEV to your program before including the CLIB's header file(s):

    #define TCPIP_DYN_LINK_DEV
    #include <clib.h>


This will map the original function's name to the dynamic linking version. This way you can also easily switch existing programs to dynamic linking.

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3SC2x
    V1.10V1.00V1.00V0.90V1.00

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document